# Copyright (C) 2018 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@rules_proto//proto:defs.bzl", "proto_library")

go_library(
    name = "go_default_library",
    srcs = [
        "astc.go",
        "atc.go",
        "convert.go",
        "convertable.go",
        "doc.go",
        "etc1.go",
        "etc2.go",
        "format.go",
        "id.go",
        "image.go",
        "png.go",
        "resizer.go",
        "rgba_f32.go",
        "rgtc.go",
        "s3.go",
        "s3_dxt1_rgb.go",
        "s3_dxt1_rgba.go",
        "s3_dxt3_rgba.go",
        "s3_dxt5_rgba.go",
        "thumbnailer.go",
        "uncompressed.go",
    ],
    embed = [":image_go_proto"],
    importpath = "github.com/google/gapid/core/image",
    visibility = ["//visibility:public"],
    deps = [
        "//core/data/binary:go_default_library",
        "//core/data/endian:go_default_library",
        "//core/data/id:go_default_library",
        "//core/data/protoutil:go_default_library",
        "//core/math/sint:go_default_library",
        "//core/os/device:go_default_library",
        "//core/stream:go_default_library",
        "//core/stream/fmts:go_default_library",
        "//gapis/database:go_default_library",
    ],
)

proto_library(
    name = "image_proto",
    srcs = ["image.proto"],
    visibility = ["//visibility:public"],
    deps = ["//core/stream:stream_proto"],
)

go_proto_library(
    name = "image_go_proto",
    importpath = "github.com/google/gapid/core/image",
    proto = ":image_proto",
    visibility = ["//visibility:public"],
    deps = ["//core/stream:go_default_library"],
)

java_proto_library(
    name = "image_java_proto",
    visibility = ["//visibility:public"],
    deps = [":image_proto"],
)

go_test(
    name = "go_default_test",
    size = "small",
    srcs = [
        "compress_test.go",
        "decompress_test.go",
        "image_test.go",
        "rgba_f32_test.go",
    ],
    data = glob(["test_data/*"]),
    deps = [
        ":go_default_library",
        "//core/data/endian:go_default_library",
        "//core/image/astc:go_default_library",
        "//core/image/etc:go_default_library",
        "//core/math/f32:go_default_library",
        "//core/math/sint:go_default_library",
        "//core/os/device:go_default_library",
        "//gapis/database:go_default_library",
    ],
)
